define(["dojo/_base/declare","dijit/_WidgetBase", "dijit/_TemplatedMixin", 
        "dojo/text!./slideShowWidget/templates/slideShowWidget.html",       
        "dojo", "dojo/_base/xhr", "dojo/on", "dojo/dom", "dojo/dom-class", "dojo/parser",
		"dojo/query", "dojo/dom-attr", "dojo/dom-style", "dojo/dom-construct", "dojo/keys",
		"dojox/widget/Standby", "dojo/fx/Toggler", "dojo/fx", "dojo/_base/fx", "dojox/fx/text", "dojox/html", "dojox/validate", "dojo/_base/connect", 
		"dijit/registry", "dojo/_base/array", "dojo/_base/lang", "dijit/layout/ContentPane",
		"dojox/html/_base"],
    function(declare, WidgetBase, TemplatedMixin, template, dojo, xhr, on, dom, domClass, parser, query, domAttr, domStyle, construct, keys,
			Standby, Toggler, coreFx, baseFx, text, html, validate, connect, registry, array, lang, ContentPane){	
        return declare([WidgetBase, TemplatedMixin], {
        	urls: [],
        	textArray: [],
            templateString: template,
            baseClass: "slideShowWidget",
        	postCreate: function(){
        		var urls = this.urls;
        		var textArray = this.textArray;
        		var domNode = this.domNode;
        		this.inherited(arguments);
        		var imageNodes = [];
        		var textNodes = [];
        		var imageContainerNode = this.imageContainerNode;
        		var textNode = this.textNode;
        		array.forEach(this.urls, function(url, index){
        			var newImgDomNode = construct.create("img", {src : url, style: "z-index: 999" });
        			var newTextNode = construct.create("p", {innerHTML : textArray[index], style: "z-index: 999"});
        			domStyle.set(newTextNode, "opacity", "0");
        			if(index != 0) domStyle.set(newImgDomNode, "opacity", "0");
        			construct.place(newImgDomNode, imageContainerNode);
        			construct.place(newTextNode, textNode);
        			imageNodes[index] = newImgDomNode;
        			textNodes[index] = newTextNode;
 		        }); 
        		sample_text_disintegrate_2(textNodes[0]).play();
        		setTimeout(function(){blockfade_2(imageNodes, textNodes)},5000); 
        	}        	
        });
});
